package com.kyleromano.disgaea.dataType;

import android.graphics.Bitmap;

public class TileSheet {
	private int tileWidth;
	private int tileHeight;
	private Bitmap tile;
	
	public TileSheet(int w, int h, Bitmap t)
	{
		tileWidth = w;
		tileHeight = h;
		tile = t;
	}
	
	public int getWidth()	{	return tileWidth;	}
	public int getHeight()	{	return tileHeight;	}
	
	/**
	 * 
	 * @param index Class - JobParent
	 * @return Single frame from the tilesheet
	 */
	public Bitmap getTile(int index)
	{
		int x = (index * tileWidth) + (index + 1);
		if(x + tileWidth <= tile.getWidth())
			return Bitmap.createBitmap(tile, x, 0, tileWidth, tileHeight);
		else
			return Bitmap.createBitmap(tile, 1, 0, tileWidth, tileHeight);
	}

}
